package com.qgs.waf.util;

import java.util.List;
import java.util.Map;

public class Pager {
	/**
	 * pageSize int 每页数量 /**pageNum int 页数 count=200; //记录总数
	 * 
	 */
	private int pageSize, pageNum, page, count, totalPage;
	private List<Object> datas;
	private Map<Object, Object> param;

	public Pager() {
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public Pager(int pageSize, int count) {
		super();
		init(pageSize, count);
	}

	public void init(int pageSize, int count) {
		this.pageSize = pageSize;
		this.count = count;
		calcTotalPage();
	}

	public Pager(int pageSize, int pageNum, int count) {
		this(pageSize, count);
		this.pageNum = pageNum;
	}

	public void calcTotalPage() {
		totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public List<Object> getDatas() {
		return datas;
	}

	public void setDatas(List<Object> datas) {
		this.datas = datas;
	}

	public Map<Object, Object> getParam() {
		return param;
	}

	public void setParam(Map<Object, Object> param) {
		this.param = param;
	}

	@Override
	public String toString() {
		return "Pager [pageSize=" + pageSize + ", pageNum=" + pageNum + ", page=" + page + ", count=" + count + ", datas=" + datas + ", param=" + param + "]";
	}

	public Pager(int pageSize, int pageNum, int page, int count, int totalPage, List<Object> datas, Map<Object, Object> param) {
		super();
		this.pageSize = pageSize;
		this.pageNum = pageNum;
		this.page = page;
		this.count = count;
		this.totalPage = totalPage;
		this.datas = datas;
		this.param = param;
	}

	public Pager(int pageSize, int pageNum, int page, int count) {
		super();
		this.pageSize = pageSize;
		this.pageNum = pageNum;
		this.page = page;
		this.count = count;
	}

	public Pager(int totalPage, List<Object> datas, Map<Object, Object> param) {
		super();
		this.totalPage = totalPage;
		this.datas = datas;
		this.param = param;
	}

	public Pager(List<Object> datas, Map<Object, Object> param) {
		super();
		this.datas = datas;
		this.param = param;
	}

}
